package com.itheima.reggie.util;


//由于Handler类中没有request对象,所以获取不到session,也获取不到存储的id值
// ThreadLocal在一个线程中域共享,故可以传递id值到MyMetaObjectHandler,
// 保证可以自动填充的时候获得对应id值
public class BaseContext {

    private BaseContext() {
    }

    private static final ThreadLocal THREAD_LOCAL = new ThreadLocal();

    public  static Long getId() {
        Long id = (Long) THREAD_LOCAL.get();
        return id;
    }

    public  static void setId(Long id) {
        THREAD_LOCAL.set(id);
    }
}
